package com.huaxia.util;

import java.util.Random;

/**
 * Created by lp on 2018/5/15.
 */
public class StrUtil {
    public static String getStr(Integer length){
        String str="";
        if (length>0) {
            for(int i=0;i<length;i++){
                str=str+"*";
            }
        }
        return str;
    }

    /**
     * 获取预约码
     * @return
     */
    public static String getOrderCode() {
        Random r = new Random();
        String code = "";
        for (int i = 0; i < 6; ++i) {
            int temp = r.nextInt(52);
            char x = (char) (temp < 26 ? temp + 97 : (temp % 26) + 65);
            code += x;
        }
        return code;
    }

    public static void main(String[] args) {
        String name="胡汉三";
       // System.out.println(getStr(name.length()-1));
        //name.replace(name.substring(1), getStr(name.length()-1));
        System.out.println(name.substring(0,1)+getStr(name.length()-1));
        //basUserSecurity.setRealname(basUserSecurity.getRealname());
    }


}
